package flc.ast.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;

import com.blankj.utilcode.util.ClipboardUtils;
import com.blankj.utilcode.util.ToastUtils;

import flc.ast.BaseAc;
import flc.ast.R;
import flc.ast.databinding.ActivityBankCardBinding;
import stark.common.apis.base.OcrBankCardRet;
import stark.common.basic.event.EventStatProxy;

public class BankCardActivity extends BaseAc<ActivityBankCardBinding> {

    public static Bitmap sBitmap;
    public static OcrBankCardRet sOcrBankCardRet;


    @Override
    protected int onCreate() {
        return R.layout.activity_bank_card;
    }

    @Override
    protected void initView() {
        EventStatProxy.getInstance().statEvent1(this, mDataBinding.event1Container);
        mDataBinding.ivBankCardRecBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        mDataBinding.ivCopy.setOnClickListener(this);
    }

    @Override
    protected void onClickCallback(View v) {
        switch (v.getId()) {
            case R.id.ivCopy:
                String content = getString(R.string.bank_name_text) + sOcrBankCardRet.bank_name + "\n" + getString(R.string.card_num_text) + sOcrBankCardRet.bank_card_number;
                ClipboardUtils.copyText(content);
                ToastUtils.showShort(R.string.copy_success_tips);
                break;
        }
    }

    @Override
    protected void initData() {
        mDataBinding.tvBankName.setText(sOcrBankCardRet.bank_name);
        mDataBinding.tvCardNumber.setText(sOcrBankCardRet.bank_card_number);
        mDataBinding.ivResultImg.setImageBitmap(sBitmap);
    }
}